Gemini - Generate Content
(24 actions, 20 KB)
0 Comment
https://ai.google.dev/api/generate-content
1 Run Shortcut
isDictionary
ăâ isDictionary
ă»
2
16
Input
:
[Shortcut Input]
Workflow
:
{ "workflowIdentifier": "F1322BB9-5821-4A59-AE61-84D4DF38EAE0", "workflowName": "isDictionary", "isSelf": false }
2 If
[1 isDictionary
as Boolean
]
is true
3 Text
[Shortcut Input
as Dictionary.prompt
]
[Shortcut Input
as Dictionary.content
]
4 Otherwise
5 Get Text from
[Shortcut Input]
6 End Ifă»
7 Run Shortcut
Sanity Check JSON String
ă»
Input
:
[6 If Result]
Workflow
:
{ "workflowIdentifier": "01C66C6E-825F-4ABF-90D6-56541924A04C", "workflowName": "Sanity Check JSON String", "isSelf": false }
8 Textă»
12
{ "contents": [{ "parts":[{"text": "
[7 Shortcut Result]
"}] }] }
9 DataJar > GetValueIntentă»
keyPath
:
API Credentials.Google
10 ToolboxProForShortcuts > CreateQueryItemIntentă»
inputType
:
text
value
:
[9 Value
as Dictionary.apiKeyGemini
]
dictionary
:
[? Dictionary]
name
:
key
11 ToolboxProForShortcuts > BuildURLIntentă»
path
:
/v1beta/models/gemini-2.0-flash:generateContent
host
:
generativelanguage.googleapis.com
queryItems
:
[10 Query Item]
12 Get Contents of URL
[11 URL]
ă»
13
14
RequestVariable
:
[8 Text]
HTTPHeaders
:
{ "Content-Type": "application/json" }
ShowHeaders
:
true
HTTPMethod
:
POST
HTTPBodyType
:
File
13 If
[12 Contents of URL
as Dictionary.candidates
]
has any value
14 Get Dictionary Value for
candidates.1.content.parts.1.text
in
[12 Contents of URL]
ă»
15 Run Shortcut
Get Plain Text from Markdown
ăâ answer
ă»
18
20
Input
:
[14 Dictionary Value]
Workflow
:
{ "workflowIdentifier": "DAB244B1-0299-4B66-A0F1-726F17ED5A84", "workflowName": "Get Plain Text from Markdown", "isSelf": false }
16 If
[1 isDictionary
as Boolean
]
is true
17 Go to Home Screen
18 Actions > WriteTextIntent
editorTitle
:
ââ ââ
\u{space}
shouldEdit
:
1
text
:
[15 answer]
19 Otherwise
20 Stop and Output
[15 answer]
21 End If
22 End Ifăâ”
13
23 Stop This Shortcut